import * as Types from '../constant/ActionTypes';

const initialState = {
  list: [{ text: 1 }],
  isFilter: false,
};

const todos = (state = initialState, action = {}) => {
  switch (action.type) {
    case Types.ADD_TODO:
      state.list = [...state.list, action.payload];
      return { ...state };
    case Types.FILTER_TODO:
      state.isFilter = !state.isFilter;
      return { ...state };
    default:
      return state;
  }
};

export default todos;